<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8.代理模式典型应用之jquery中的proxy</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<body>
    <button>点我变红</button>
    <script>
        let btn = document.getElementsByTagName('button')[0];
        console.log(btn);
        function proxy(fn,context) { 
            return fn.bind(context);
         };
        btn.addEventListener('click',function () { 
            setTimeout(proxy(function () {
                $(this).css({'color':"red"});
            },this),0)
            
         })
    </script>
</body>
</html>